<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/5/25 0025
 * Time: 上午 11:37
 */
header("Content-type:text/html;charset=utf-8");  //统一输出编码为utf-8
header('Access-Control-Allow-Origin:*'); //* 不做显示


if(!empty($_POST)&&$_POST["email"]!=""&&$_POST["pwd"]!=""){
    $uEmail=$_POST["email"];
    $uPwd=$_POST["pwd"];


    $dbserver="127.0.0.1";
    $dbuser="root";
    $dbpwd="";
    $dbdatabase="hy";
    $conn=new mysqli($dbserver,$dbuser,$dbpwd,$dbdatabase);
    mysqli_query($conn,"set names utf8");

//    print_r($conn->connect_error);
    $sql = "INSERT INTO userinfo(uEmail,uPwd)
    VALUES('".$uEmail."','".$uPwd."')";
//    print_r($sql);
    //执行sql语句
    $resutl = $conn->query($sql);
    //8.获取结果
    $arr = array("status"=>1,"mesg"=>"注册成功");
    print_r(json_encode($arr));
    //5.关闭链接
    $conn->close();
}else{
    $arr = array("status"=>0,"mesg"=>"注册失败");
    print_r(json_encode( $arr));
}


